#include "zendjinn.h"

int main(int argc, char** argv)
{
    try {
        if (!ZenDjinn::setActive(new ZenDjinn("Factory test")))
            throw ("Could not activate ZenDjinn");

        if (!ZenDjinn::getActive()->load()) {
            if (!Keyboard::setActive(new Keyboard))
                throw ("Could not activate Keyboard");
            if (!Mouse::setActive(new Mouse))
                throw ("Could not activate Mouse");
            if(!ZenDjinn::getActive()->save())
                throw ("Could not save ZenDjinn");
        }
        if (!ZenDjinn::getActive()->init())
            throw ("Could not init ZenDjinn");
    }
    catch (const char *error) {
        cerr << "main() : " << error << endl;
        ZenDjinn::setActive(0);
        return -1;
    }

    // ZenDjinn::getActive()->run();

    cout << "Done\n";
    SDL_Delay(1000);

    ZenDjinn::setActive(0);

    return 0;
}
